cc.Class({
    extends: cc.Component,

    properties: {
        headbg: cc.Sprite,
        head: cc.Node,
        rankNo: cc.Label,
        score: cc.Label,
        rankName: cc.Label,
    },

    onLoad() {


    },
    init: function (playerInfo) {
        this.loadheadIme(playerInfo.image);
        var _img = playerInfo.player.photo;
        this.rankName.string = playerInfo.player.name;
        this.rankNo.string=playerInfo.rank;
        this.score.string=playerInfo.score;
        this.loadheadIme(_img);
    },
    loadheadIme(playerPic) {
        var that = this;
        if (playerPic) {
            var container = this.head.getComponent(cc.Sprite);
            /*加载远程资源*/
            cc.loader.load(playerPic, function (err, texture) {
                var sprite = new cc.SpriteFrame(texture);
                that.head.width = 60;
                that.head.height = 58;
                container.spriteFrame = sprite;
                that.head.width = 60;
                that.head.height = 58;
                /*防止从facebook上下载下来的图片大于或者小于100*100 尺寸的图片*/

            });
        }
    },

    start() {

    },

    // update (dt) {},
});
